<div class="am-g">
    <!-- Row start -->
    <div class="am-u-sm-12">
        <form action="" class="am-form" data-am-validator id="doc-vld-msg">
            <div class="card-box">

                <fieldset>
                    <div class="am-form-group am-form-group-sm">
                        <label for="doc-vld-name-2">出库主题：</label>
                        <input type="text" name="name" class="am-form-field" id="fname" placeholder="分类名称" />
                    </div>
                    <div class="am-form-group am-form-group-sm">
                        <label for="doc-vld-name-2">备注：</label>
                        <input type="text" name="markte" class="am-form-field" id="fname" placeholder="分类名称" />
                    </div>
                    <div class="am-form-group">
                        <div class="am-g">
                            <label class="am-u-md-2 am-md-text-right" for="doc-select-1">仓库</label>
                            <select id="doc-select-1" name="deid" id="pids">
                                {{range .depot}}
                                <option value="{{.Id}}">{{.Name}}</option>
                                {{end}}
                            </select>
                            <span class="am-form-caret"></span>
                        </div>
                    </div>
                    <button class="am-btn am-btn-secondary" type="button">提交</button>

                </fieldset>

            </div>
            <div class="am-scrollable-horizontal">
                <table class="am-table am-table-striped am-table-hover table-main am-text-nowrap">
                    <input id="zprice-num" style="display:none" name="zprice" value="0.00">
                    <thead>
                        <tr>
                            <th class="table-id">名称</th>
                            <th class="table-title">单位</th>
                            <th class="table-title">数量</th>
                            <th class="table-title">编码</th>
                            <th class="table-title">价格</th>
                            <th class="table-title">规格</th>
                            <th class="table-title">型号</th>
                            <th class="table-title">分类</th>
                            <th class="table-title">状态</th>
                            <th class="table-title">销售状态</th>
                            <th class="table-type">添加时间</th>
                        </tr>
                    </thead>
                    <tbody>
                        {{range .glist}}
                        <tr>
                            <td>{{.Name}}</td>
                            <td>{{.Units}}</td>
                            <td><input style="display:none" name="goods[]" class="am-form-field" value="{{.Id}}">
                                <input style="width:100px" name="GoodsNum[]" class="am-form-field" value="1">
                            </td>
                            <td>{{.Gcode}}</td>
                            <td>{{.Price}}</td>
                            <td>{{.Spec}}</td>
                            <td>{{.Gmodel}}</td>
                            <td>{{.Sname}}</td>
                            <td>{{.Status}}</td>
                            <td>{{.SaleStatus}}</td>
                            <td>{{timetodateint64 .Ctime}}</td>
                        </tr>
                        {{end}}
                    </tbody>
                </table>
            </div>
        </form>
    </div>
    <!-- Row end -->
</div>
</div>
</div>
<script>
    var _url = "/outgoing/add"
    $(".am-btn").on("click", function () {
        var name = $("#fname").val();
        var pid = $("#pids").val();
        if (name.length < 1) {
            alert("分类名称不能为空！")
            return
        }
        $.post(_url, $("form").serializeArray(), function (data) {
            if (data.status == 1) {
                alert("添加成功")
                window.location.href = data.url
            } else {
                alert(data.msg);
            }
        }, "json");
    });

</script>